<?php
class GravatarForm extends Zend_Form {
    public function __construct($options = null) 
    {
    	$translate	= Zend_Registry::get('lang');
    	
        parent::__construct($options);
        
        $this->setName('gravatar');
        
		// enable
		$enable = new Zend_Form_Element_Checkbox('gravatar_active');
		$enable->setLabel($translate->_('form_profile_gravatar_active'));
		$enable->setDescription($translate->_('form_profile_gravatar_dactive'));
		
		// mail
        $mail = new Zend_Form_Element_Text('gravatar_mail');
        $mail->setLabel($translate->_('form_profile_gravatar_mail'));
        $mail->setDescription($translate->_('form_profile_gravatar_dmail'));
        $mail->setRequired(true);
        $mail->addValidator('NotEmpty');
        $mail->setErrorMessages(array(
            0 => $translate->_('form_profile_gravatar_mail_error')
        ));
        
		// rating
        $rating	= new Zend_Form_Element_Select('gravatar_rating');
       	$rating->setRegisterInArrayValidator(false);
        $rating->setLabel($translate->_('form_profile_gravatar_rating'));
        $rating->setDescription($translate->_('form_profile_gravatar_drating'));
        $rating->addMultiOption('g', $translate->_('form_profile_gravatar_rating_g'));
        $rating->addMultiOption('pg', $translate->_('form_profile_gravatar_rating_pg'));
        $rating->addMultiOption('r', $translate->_('form_profile_gravatar_rating_r'));
        $rating->addMultiOption('x', $translate->_('form_profile_gravatar_rating_x'));
        
        // size
        $size	= new Zend_Form_Element_Select('gravatar_size');
       	$size->setRegisterInArrayValidator(false);
        $size->setLabel($translate->_('form_profile_gravatar_size'));
        $size->setDescription($translate->_('form_profile_gravatar_dsize'));
        $size->addMultiOption('40', $translate->_('form_profile_gravatar_size_40'));
        $size->addMultiOption('80', $translate->_('form_profile_gravatar_size_80'));
        $size->addMultiOption('160', $translate->_('form_profile_gravatar_size_160'));
        
        // Submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel($translate->_('form_save'));
        
        $this->addElements(array($enable, $mail, $rating, $size, $submit));
    }
}  
?>